package cn.neusoft.luofa603.yuejian.Adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by P.Block on 2017/09/27.
 */

public class TabPagerAdapter<F extends Fragment> extends FragmentPagerAdapter {
    private List<F> fragments;
    private List<String> titles;

    public TabPagerAdapter(FragmentManager fm, List<F> fragments, List<String> titles) {
        super(fm);
        this.fragments = fragments;
        this.titles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return titles.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles.get(position);
    }
}
